<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

<ui:define name="head">
    <link type="text/css" href="#{request.contextPath}/UI/epss/epss.css" rel="stylesheet"/>
    <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
    <script type="text/javascript" language="javascript">
        document.onkeydown = function TabReplace() {
            if (event.keyCode == 13) {
                if (event.srcElement.tagName != 'BUTTON')
                    event.keyCode = 9;
                else
                    event.srcElement.click();
            }
        }
        function actSelect(obj, pageName) {
            var pkid = obj;
            var sfeature = "dialogwidth:1100px;dialogheight:600px;center:yes;location:no;help:no;resizable:no;scroll:yes;status:no";
            var arg = new Object();
            arg.doType = "select";
            if (pageName == "Sub_Detail") {
                var rtn = dialog("../item/itemQry_Cstpl_Sub.xhtml?strType=2&amp;strSubCttPkid=" + pkid + "", arg, sfeature);
            } else if (pageName == "Attachment") {
                var rtn = window.open("/epss/servlet/ShowServlet?operType=Qry&amp;strType=0&amp;strPkid=" + pkid + "",
                        'popupwindow',
                        'height = 300,width = 450,location = no,resizable = no,scrollbars = no,status = no,toolbar = no,top = 100');
            }
        }
    </script>
</ui:define>
<ui:define name="content">
    <h:form id="form" enctype="multipart/form-data">
        <p:growl id="msgs" showDetail="true"/>
        <p:focus for="id"/>
        <p:panel>
            <h:panelGrid id="pdQry" columns="2" style="width: 100%">
                <h:panelGrid columns="4">
                    <p:outputLabel value="合同编号：" for="id"/>
                    <p:inputText id="id"
                                 value="#{subCttInfoAction.itemEsInitCttQry.id}"/>
                    <p:outputLabel value="合同名称：" for="cttName"/>
                    <p:inputText id="cttName"
                                 value="#{subCttInfoAction.itemEsInitCttQry.name}"/>
                </h:panelGrid>
                <h:panelGrid columns="3">
                    <p:commandButton id="qryBtn" value="查询"
                                     action="#{subCttInfoAction.onQueryAction('Check')}"
                                     update="pdt,pdQry,msgs,pgCondition">
                    </p:commandButton>
                    <p:commandButton id="resetBtn" value="重置"
                                     type="reset"
                                     update="pdQry,msgs">
                    </p:commandButton>
                    <p:ajaxStatus style="width:16px;height:16px;">
                        <f:facet name="start">
                            <h:graphicImage value="/images/ajaxloading.gif"/>
                        </f:facet>
                        <f:facet name="complete">
                            <h:outputText value=""/>
                        </f:facet>
                    </p:ajaxStatus>
                </h:panelGrid>
            </h:panelGrid>
        </p:panel>
        <h:panelGrid columns="3" id="pgCondition">
            <p:commandButton id="checkPassBtn" value="审核通过"
                             action="#{subCttInfoAction.onClickForPowerAction('CheckPass')}"
                             update="pgCondition,pdt,msgs"
                             rendered="#{subCttInfoAction.rowSelectedFlag}">
            </p:commandButton>
            <p:commandButton id="checkFailBtn" value="审核未过至状态:"
                             action="#{subCttInfoAction.onClickForPowerAction('CheckFail')}"
                             update="pgCondition,pdt,msgs"
                             rendered="#{subCttInfoAction.rowSelectedFlag}">
            </p:commandButton>
            <p:selectOneMenu id="statusFlag" value="#{subCttInfoAction.strNotPassToStatus}"
                             rendered="#{subCttInfoAction.rowSelectedFlag}">
                <f:selectItems value="#{esFlowControl.statusFlagList}"/>
            </p:selectOneMenu>
        </h:panelGrid>
        <!--列表维护-->
        <p:contextMenu for="pdt">
            <p:menuitem value="浏览" icon="ui-icon-search"
                        actionListener="#{subCttInfoAction.selectRecordAction('Qry','')}"
                        update="pgView,pdt,msgs"
                        onclick="PF('wVDlgView').show()">
            </p:menuitem>
            <p:menuitem value="选择" icon="ui-icon-plus"
                        actionListener="#{subCttInfoAction.selectRecordAction('Check','')}"
                        update="pdt,msgs,pgCondition">
            </p:menuitem>
            <p:menuitem value="详细内容" icon="ui-icon-search"
                        oncomplete="actSelect(DtInitSubcttList.selection,'Sub_Detail')">
            </p:menuitem>
            <p:menuitem value="附件" icon="ui-icon-search"
                        oncomplete="actSelect(DtInitSubcttList.selection,'Attachment')">
            </p:menuitem>
        </p:contextMenu>
        <p:dataTable id="pdt" style="width:100%;"
                     value="#{subCttInfoAction.itemEsInitCttList}"
                     var="record"
                     rowKey="#{record.pkid}"
                     selection="#{subCttInfoAction.itemEsInitCttSelected}"
                     selectionMode="single"
                     paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
                         {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                     paginator="true"
                     paginatorPosition="bottom"
                     rows="15"
                     rowIndexVar="row"
                     rowsPerPageTemplate="500,200,100,45,30,15"
                     emptyMessage="数据记录为空..."
                     widgetVar="DtInitSubcttList"
                     rowStyleClass="#{record.statusFlag eq '0'? null :'rowDoneStyle'}"
                     scrollable="true">
            <!--<p:ajax event="rowSelect" listener="#{esInitCttAction.onRowSelect}" update=":form"/>-->
            <p:column headerText="序号" style="width:30px">
                <h:outputText value="#{row + 1}"/>
            </p:column>
            <p:column headerText="分包合同号" style="width:120px;text-align:center">
                <h:outputText value="#{record.id}"/>
            </p:column>
            <p:column headerText="分包合同名" style="width:200px;text-align:left">
                <h:outputText value="#{record.name}"/>
            </p:column>
            <p:column headerText="签订甲方" style="width:200px;text-align:left">
                <h:outputText value="#{esCommon.getCustNameByCustIdFromList(record.signPartA)}"/>
            </p:column>
            <p:column headerText="签订乙方" style="width:200px;text-align:left">
                <h:outputText value="#{esCommon.getCustNameByCustIdFromList(record.signPartB)}"/>
            </p:column>
            <p:column headerText="状态标志" style="width:66px;text-align:center">
                <h:outputText value="#{esFlowControl.getLabelByValueInStatusFlaglist(record.statusFlag)}"/>
            </p:column>
            <p:column headerText="原因" style="width:66px;text-align:center">
                <h:outputText value="#{esFlowControl.getLabelByValueInPreStatusFlaglist(record.preStatusFlag)}"/>
            </p:column>
            <p:column headerText="开始时间" style="width:66px;text-align:center">
                <h:outputText value="#{record.cttStartDate}"/>
            </p:column>
            <p:column headerText="截止时间" style="width:66px;text-align:center">
                <h:outputText value="#{record.cttEndDate}"/>
            </p:column>
            <p:column headerText="签订日期" style="width:66px;text-align:center">
                <h:outputText value="#{record.signDate}"/>
            </p:column>
        </p:dataTable>
        <p:dialog id="dlgView" header="分包合同维护" widgetVar="wVDlgView"
                  resizable="false" modal="true"
                  showEffect="clip" hideEffect="fold">
            <h:panelGrid id="pgView">
                <h:panelGrid columns="2">
                    <p:outputLabel value="合同编号：" for="idForDlg"/>
                    <p:inputText id="idForDlg" value="#{subCttInfoAction.itemEsInitCttSel.id}"
                                 readonly="true"
                                 style="background-color:gainsboro;"/>
                </h:panelGrid>
                <h:panelGrid columns="2">
                    <p:outputLabel value="合同名称：" for="cttNameForDlg"/>
                    <p:inputText id="cttNameForDlg" value="#{subCttInfoAction.itemEsInitCttSel.name}"
                                 readonly="true"
                                 style="background-color:gainsboro;width:328px;"/>
                </h:panelGrid>
                <h:panelGrid columns="4">
                    <p:outputLabel value="备注内容：" for="noteForDlg"/>
                    <p:inputText id="noteForDlg" value="#{subCttInfoAction.itemEsInitCttSel.note}"
                                 readonly="true"
                                 style="background-color:gainsboro;"/>
                    <p:outputLabel value="签订日期：" for="signDateForDlg"/>
                    <p:inputText id="signDateForDlg" value="#{subCttInfoAction.itemEsInitCttSel.signDate}"
                                 readonly="true"
                                 style="background-color:gainsboro;"/>
                    <p:outputLabel value="开始时间：" for="cttStartDateForDlg"/>
                    <p:inputText id="cttStartDateForDlg" value="#{subCttInfoAction.itemEsInitCttSel.cttStartDate}"
                                 readonly="true"
                                 style="background-color:gainsboro;"/>
                    <p:outputLabel value="截止时间：" for="cttEndDateForDlg"/>
                    <p:inputText id="cttEndDateForDlg" value="#{subCttInfoAction.itemEsInitCttSel.cttEndDate}"
                                 readonly="true"
                                 style="background-color:gainsboro;"/>
                </h:panelGrid>
                <h:panelGrid columns="2">
                    <p:outputLabel value="签订甲方：" for="signPartAForDlg"/>
                    <p:inputText id="signPartAForDlg" value="#{subCttInfoAction.itemEsInitCttSel.signPartAName}"
                                 readonly="true"
                                 style="background-color:gainsboro;width:328px;">
                    </p:inputText>
                    <p:outputLabel value="签订乙方：" for="signPartBForDlg"/>
                    <p:inputText id="signPartBForDlg" value="#{subCttInfoAction.itemEsInitCttSel.signPartBName}"
                                 readonly="true"
                                 style="background-color:gainsboro;width:328px;">
                    </p:inputText>
                </h:panelGrid>
            </h:panelGrid>
        </p:dialog>
    </h:form>
</ui:define>
</ui:composition>